﻿using Sunny.UI;
using System;

namespace CentralVacuum.Keyboard
{
    public partial class StringBoard : UIForm
    {
        private UITextBox vUiTextBox;
        private int initflag = 0;   //  初始化标识
        public StringBoard()
        {
            InitializeComponent();
            
        }
        /// <summary>
        /// 给控件赋值的方法
        /// </summary>
        /// <param name="strValue"></param>
        public void SetValue(UITextBox strValue)
        {
            vUiTextBox = strValue;
            this.uiTextBox1.PasswordChar = vUiTextBox.PasswordChar;
        }

        private void StringBoard_Load(object sender, EventArgs e)
        {
            this.uiTextBox1.Text = this.vUiTextBox.Text;
            this.uiTextBox1.Type = this.vUiTextBox.Type;
        }
        private void AddNumber(string num)
        {
            if (initflag == 0)
            {
                this.uiTextBox1.Text = "";
                initflag = 1;
            }
            this.uiTextBox1.Text += num;
        }

        private void uiButton1_Click(object sender, EventArgs e)
        {
            AddNumber("1");
        }

        private void uiButton2_Click(object sender, EventArgs e)
        {
            AddNumber("2");
        }

        private void uiButton3_Click(object sender, EventArgs e)
        {
            AddNumber("3");
        }

        private void uiButton4_Click(object sender, EventArgs e)
        {
            AddNumber("4");
        }

        private void uiButton5_Click(object sender, EventArgs e)
        {
            AddNumber("5");
        }

        private void uiButton6_Click(object sender, EventArgs e)
        {
            AddNumber("6");
        }

        private void uiButton7_Click(object sender, EventArgs e)
        {
            AddNumber("7");
        }

        private void uiButton8_Click(object sender, EventArgs e)
        {
            AddNumber("8");
        }

        private void uiButton9_Click(object sender, EventArgs e)
        {
            AddNumber("9");
        }

        private void uiButton10_Click(object sender, EventArgs e)
        {
            AddNumber("0");
        }

        private void uiButton20_Click(object sender, EventArgs e)
        {
            AddNumber("Q");
        }

        private void uiButton19_Click(object sender, EventArgs e)
        {
            AddNumber("W");
        }

        private void uiButton18_Click(object sender, EventArgs e)
        {
            AddNumber("E");
        }

        private void uiButton17_Click(object sender, EventArgs e)
        {
            AddNumber("R");
        }

        private void uiButton16_Click(object sender, EventArgs e)
        {
            AddNumber("T");
        }

        private void uiButton15_Click(object sender, EventArgs e)
        {
            AddNumber("Y");
        }

        private void uiButton14_Click(object sender, EventArgs e)
        {
            AddNumber("U");
        }

        private void uiButton13_Click(object sender, EventArgs e)
        {
            AddNumber("I");
        }

        private void uiButton12_Click(object sender, EventArgs e)
        {
            AddNumber("O");
        }

        private void uiButton11_Click(object sender, EventArgs e)
        {
            AddNumber("P");
        }

        private void uiButton30_Click(object sender, EventArgs e)
        {
            AddNumber("A");
        }

        private void uiButton29_Click(object sender, EventArgs e)
        {
            AddNumber("S");
        }

        private void uiButton28_Click(object sender, EventArgs e)
        {
            AddNumber("D");
        }

        private void uiButton27_Click(object sender, EventArgs e)
        {
            AddNumber("F");
        }

        private void uiButton26_Click(object sender, EventArgs e)
        {
            AddNumber("G");
        }

        private void uiButton25_Click(object sender, EventArgs e)
        {
            AddNumber("H");
        }

        private void uiButton24_Click(object sender, EventArgs e)
        {
            AddNumber("J");
        }

        private void uiButton23_Click(object sender, EventArgs e)
        {
            AddNumber("K");
        }

        private void uiButton22_Click(object sender, EventArgs e)
        {
            AddNumber("L");
        }

        private void uiButton40_Click(object sender, EventArgs e)
        {
            AddNumber("Z");
        }

        private void uiButton39_Click(object sender, EventArgs e)
        {
            AddNumber("X");
        }

        private void uiButton38_Click(object sender, EventArgs e)
        {
            AddNumber("C");
        }

        private void uiButton37_Click(object sender, EventArgs e)
        {
            AddNumber("V");
        }

        private void uiButton36_Click(object sender, EventArgs e)
        {
            AddNumber("B");
        }

        private void uiButton35_Click(object sender, EventArgs e)
        {
            AddNumber("N");
        }

        private void uiButton34_Click(object sender, EventArgs e)
        {
            AddNumber("M");
        }

        private void uiButton21_Click(object sender, EventArgs e)
        {
            AddNumber("_");
        }

        private void uiButton33_Click(object sender, EventArgs e)
        {
            AddNumber(".");
        }

        private void uiButton41_Click(object sender, EventArgs e)
        {
            this.Close();   // ESC按钮
        }

        private void uiButton31_Click(object sender, EventArgs e)
        {
            vUiTextBox.Text = this.uiTextBox1.Text;
            this.Close();
        }

        private void uiButton32_Click(object sender, EventArgs e)
        {
            this.uiTextBox1.Text = "";
        }
    }
}
